package me.xplabs.view 
{
	import flash.display.DisplayObjectContainer;
	import flash.events.MouseEvent;
	import me.xplabs.Globals;
	import me.xplabs.msg.NotificationFight;
	import me.xplabs.msg.NotificationName;
	import me.xplabs.ui.baseui.Button;
	import me.xplabs.ui.BaseView;
	import me.xplabs.ui.UICompent;
	
	/**
	 * http://www.xplabs.me/
	 * @author xiaohan
	 */
	public class RaidMenuView extends BaseView 
	{
		private var _isSuspend:Boolean;
		/** 暂停按钮*/
		private var _suspendBtn:Button;
		private var _menuBtn:Button;
		public function RaidMenuView(pfather:DisplayObjectContainer) 
		{
			super(pfather);
		}
		override protected function init():void 
		{
			super.init();
			
			_suspendBtn = Globals.ui.button("", 10);
			addChild(_suspendBtn);
			_suspendBtn.callback = clickSuspendHandler;
			
			_menuBtn = Globals.ui.button("", 11);
			addChild(_menuBtn);
			_menuBtn.x = _suspendBtn.x + _suspendBtn.width + 10;
			_menuBtn.callback = clickMenuHandler;
		}
		
		private function clickMenuHandler(e:MouseEvent):void 
		{
			sendMsg(NotificationName.FIGHT_MAP_MANAGER, null, NotificationFight.SUSPEND_GAME);
			sendMsg(NotificationName.SHOW_GAME_MENU);
		}
		
		private function clickSuspendHandler(e:MouseEvent):void 
		{
			_isSuspend = !_isSuspend;
			//if(_isSuspend) 
				//Globals.gameManager.stopUpdate();
			//else 
				//Globals.gameManager.startUpdate();
			if(_isSuspend) 
				sendMsg(NotificationName.FIGHT_MAP_MANAGER, null, NotificationFight.SUSPEND_GAME);
			else 
				sendMsg(NotificationName.FIGHT_MAP_MANAGER, null, NotificationFight.REGAIN_GAME);
		}
	}
}